package com.dropesoft.biz;

import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

public class TypesDbAdapter {

	private static final String DATABASE_TABLE = "types";
	
    public static final String KEY_ROWID = "_id";
    public static final String KEY_INTERNALNAME = "internal_name";
    
    private DbHelper _dbHelp;
    private SQLiteDatabase _database;
    
    public void open() throws SQLException {
    	_database = _dbHelp.getWritableDatabase();
	}

	public void close() {
		_database.close();
	}
	
	public TypesDbAdapter(Context context)
	{
		_dbHelp = new DbHelper(context);
		
	}
	public Cursor listAllTypes()  throws SQLException 
	{
		Cursor cursor = _database.query(true, DATABASE_TABLE, new String[] {
				KEY_ROWID,
             	KEY_INTERNALNAME}, null, null,
             null, null, null, null);
		return cursor;
	}
}
